package spring.cloud.tasks.tasks_manager.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import java.io.Serializable;

@Slf4j
@Setter
@Getter
public class NameSpaceConfiguration implements Serializable {
    private static final long serialVersionUID = -5996257770767863699L;


    private String zooKeeperAddressList;

    private String nameSpace;

    private String alias;

    private String zooKeeperClusterKey;

    private String digest;


    /**
     * 系统重要程度
     **/
    private String degree;


    private Boolean container;

    public NameSpaceConfiguration(final String zooKeeperAddressList, final String nameSpace) {
        this.zooKeeperAddressList = zooKeeperAddressList;
        this.nameSpace = nameSpace;
    }

    public NameSpaceConfiguration() {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        NameSpaceConfiguration that = (NameSpaceConfiguration) o;


        if (zooKeeperAddressList != null ? !zooKeeperAddressList.equals(that.zooKeeperAddressList) : that.zooKeeperAddressList != null)
            return false;
        if (nameSpace != null ? !nameSpace.equals(that.nameSpace) : that.nameSpace != null) return false;
        if (alias != null ? !alias.equals(that.alias) : that.alias != null) return false;
        if (zooKeeperClusterKey != null ? !zooKeeperClusterKey.equals(that.zooKeeperClusterKey) : that.zooKeeperClusterKey != null) return false;
        if (digest != null ? !digest.equals(that.digest) : that.digest != null) return false;

        if (degree != null ? !degree.equals(that.degree) : that.degree != null) return false;
        return container != null ? container.equals(that.container) : that.container == null;

    }

    @Override
    public int hashCode() {
        int result = 0;
        result = 31 * result + (zooKeeperAddressList != null ? zooKeeperAddressList.hashCode() : 0);
        result = 31 * result + (nameSpace != null ? nameSpace.hashCode() : 0);
        result = 31 * result + (alias != null ? alias.hashCode() : 0);
        result = 31 * result + (zooKeeperClusterKey != null ? zooKeeperClusterKey.hashCode() : 0);
        result = 31 * result + (digest != null ? digest.hashCode() : 0);


        result = 31 * result + (degree != null ? degree.hashCode() : 0);

        result = 31 * result + (container != null ? container.hashCode() : 0);
        return result;
    }


}
